home *** CD-ROM | disk | FTP | other *** search
/ Aminet 1 (Walnut Creek) / Aminet - June 1993 [Walnut Creek].iso / usenet / sources / volume89 / aplictns / hp11.1 < prev    next >
Internet Message Format  |  1989-11-13  |  43KB

  1. Path: xanth!mcnc!rutgers!usc!brutus.cs.uiuc.edu!wuarchive!texbell!texsun!newstop!sun!swap!page
  2. From: page%swap@Sun.COM (Bob Page)
  3. Newsgroups: comp.sources.amiga
  4. Subject: v89i198:  hp11 calculator emulator v1.01, Part01/03
  5. Message-ID: <127768@sun.Eng.Sun.COM>
  6. Date: 13 Nov 89 01:35:42 GMT
  7. Sender: news@sun.Eng.Sun.COM
  8. Lines: 1706
  9. Approved: page@sun.com
  10.  
  11. Submitted-by: dg3i+@andrew.cmu.edu (David Gay)
  12. Posting-number: Volume 89, Issue 198
  13. Archive-name: applications/hp11.1
  14.  
  15. A new version of this RPN calculator emulator.
  16.  
  17. # This is a shell archive.
  18. # Remove anything above and including the cut line.
  19. # Then run the rest of the file through 'sh'.
  20. # Unpacked files will be owned by you and have default permissions.
  21. #----cut here-----cut here-----cut here-----cut here----#
  22. #!/bin/sh
  23. # shar: SHell ARchive
  24. # Run the following text through 'sh' to create:
  25. #    amiga/amiga.c
  26. #    amiga/amiga.h
  27. #    amiga/cbio.c
  28. #    amiga/cbio.h
  29. #    amiga/chars.c
  30. #    amiga/chip.c
  31. # This is archive 1 of a 3-part kit.
  32. # This archive created: Sun Nov 12 17:33:20 1989
  33. if `test ! -d amiga`
  34. then
  35.   mkdir amiga
  36.   echo "mkdir amiga"
  37. fi
  38. echo "extracting amiga/amiga.c"
  39. sed 's/^X//' << \SHAR_EOF > amiga/amiga.c
  40. X#include "exec/types.h"
  41. X#include "exec/ports.h"
  42. X#include "exec/io.h"
  43. X#include "exec/memory.h"
  44. X#include "graphics/gfx.h"
  45. X#include "devices/timer.h"
  46. X#include "libraries/dos.h"
  47. X#include "workbench/startup.h"
  48. X
  49. X#include "proto/exec.h"
  50. X#include "proto/graphics.h"
  51. X#include "proto/layers.h"
  52. X#include "proto/intuition.h"
  53. X#include "proto/timer.h"
  54. X#include "proto/dos.h"
  55. X
  56. X#include "string.h"
  57. X#include "ctype.h"
  58. X#include "dos.h"
  59. X
  60. X#include "hp11/hp11.h"
  61. X#include "hp11/amiga/internal.h"
  62. X#include "hp11/amiga/amiga.h"
  63. X#include "hp11/amiga/menus.h"
  64. X
  65. X#define MAXWIDTH 29 /* X distance between 2 keys */
  66. X#define MAXHEIGHT 29 /* Y distance bewteen 2 keys */
  67. X#define KEYWIDTH 20 /* Width of actual key */
  68. X#define KEYHEIGHT 16 /* Height of actual key */
  69. X#define TOPKEYHEIGHT 9 /* Height of top of key */
  70. X#define KEYX (19 + HP11X) /* Position of first key */
  71. X#define KEYY (61 + HP11Y)
  72. X#define CHAROFFX -1 /* offset in display for first char */
  73. X#define CHAROFFY 3
  74. X#define CHARWIDTH 14 /* Size of char */
  75. X#define CHARHEIGHT 13
  76. X#define SCRX0 (53 + HP11X) /* Limits of display for chars */
  77. X#define SCRX1 (208 + HP11X)
  78. X#define SCRY0 (11 + HP11Y)
  79. X#define SCRY1 (37 + HP11Y)
  80. X#define fX (SCRX0 + 3 * CHARWIDTH + 2) /* Position of indicators */
  81. X#define gX (SCRX0 + 4 * CHARWIDTH - 1)
  82. X#define GX (SCRX0 + (int)(6.5 * CHARWIDTH))
  83. X#define RADX (GX + 5)
  84. X#define PRGMX (SCRX0 + 10 * CHARWIDTH - 6)
  85. X#define USERX (SCRX0 + CHARWIDTH)
  86. X#define INDICY (SCRY0 + 19)
  87. X
  88. X#define CR 13
  89. X#define BS 8
  90. X#define ESC 27
  91. X
  92. X#define COPY 0xc0 /* minterm for straight copy */
  93. X
  94. Xstruct Library *TimerBase; /* Base for calling timer routines */
  95. X
  96. Xextern struct Border *hp11char[]; /* Character descriptions (as connected lines) */
  97. X/* Indicator shapes (as bitmaps) */
  98. Xextern struct Image fImage, gImage, USERImage, GImage, RADImage, PRGMImage;
  99. Xextern struct Image off_image; /* Image for sleep */
  100. X
  101. Xextern struct IntuitionBase *IntuitionBase;
  102. Xextern struct GfxBase *GfxBase;
  103. Xstruct LayersBase *LayersBase;
  104. X
  105. Xstruct Window *hp11; /* The window containing the hp11 */
  106. X
  107. X/* These informations are for RelKey() */
  108. X/* The method by which the latest key was obtained :
  109. X  From the menus, from the CLOSE gadget, from the keyboard, or by selecting with the mouse */
  110. Xstatic enum {menu, gadget, keyboard, mouse} keytype;
  111. X/* The keycode of the last key read */
  112. Xstatic short lastkey;
  113. X/* The Time at which the last key was read */
  114. Xstatic ULONG secs, micros;
  115. X/* Path to executable */
  116. Xchar *hp11name;
  117. Xchar hp11path[PATHLEN];
  118. X
  119. Xstatic struct timerequest *timer; /* The timer which is used */
  120. Xstatic struct NewWindow hp11new = { /* Desired window */
  121. X   0,0, /* Position of top left corner */
  122. X   HP11WIDTH + 6, HP11HEIGHT + 14, /* Width, Height */
  123. X   -1,-1, /* Use default pens to draw window */
  124. X   CLOSEWINDOW | MOUSEBUTTONS | VANILLAKEY | MENUPICK,
  125. X   WINDOWDEPTH | WINDOWCLOSE | WINDOWDRAG | SMART_REFRESH | NOCAREREFRESH,
  126. X   NULL, NULL,
  127. X   "HP11C", NULL,
  128. X   NULL,
  129. X   0, 0, 0, 0,
  130. X   WBENCHSCREEN /* It opens in the main screen */
  131. X};
  132. X
  133. Xstatic struct IntuiText canceltext = {
  134. X   AUTOFRONTPEN, AUTOBACKPEN,
  135. X   AUTODRAWMODE,
  136. X   AUTOLEFTEDGE, AUTOTOPEDGE,
  137. X   AUTOITEXTFONT,
  138. X   "Cancel",
  139. X   AUTONEXTTEXT
  140. X};
  141. X
  142. Xstatic struct IntuiText nomemtext = {
  143. X   AUTOFRONTPEN, AUTOBACKPEN,
  144. X   AUTODRAWMODE,
  145. X   20, 10,
  146. X   AUTOITEXTFONT,
  147. X   "Not enough memory",
  148. X   NULL
  149. X};
  150. X
  151. Xchar *mygetpath(to, l)
  152. Xregister char *to;
  153. Xregister BPTR l;
  154. X{
  155. X   register BPTR tl;
  156. X   register int notfirst = FALSE;
  157. X   register struct FileInfoBlock *fib = (struct FileInfoBlock *)AllocMem(sizeof(struct FileInfoBlock), 0);
  158. X
  159. X   if (!fib) return(NULL);
  160. X   to[0] = '\0';
  161. X
  162. X   do {
  163. X      if (!Examine(l, fib)) return(NULL);
  164. X      if (fib->fib_DirEntryType > 0) strins(to, "/");
  165. X      if (fib->fib_FileName[0] == '\0') strins(to, "RAM");
  166. X      else strins(to, fib->fib_FileName);
  167. X      tl = l;
  168. X      l = ParentDir(l);
  169. X      if (notfirst) UnLock(tl);
  170. X      notfirst = TRUE;
  171. X   } while (l);
  172. X
  173. X   *(strchr(to, '/')) = ':';
  174. X   FreeMem((char *)fib, sizeof(struct FileInfoBlock));
  175. X   return(to);
  176. X}
  177. X
  178. Xvoid split(char *file, char *path, char **name)
  179. X{
  180. X   int l = strlen(file);
  181. X
  182. X   *name = file + l;
  183. X   while (--l >= 0 && (*--*name != '/' && **name != ':')) ;
  184. X   if (l < 0)
  185. X      path[0] = '\0';
  186. X   else
  187. X   {
  188. X      ++*name;
  189. X      strncpy(path, file, l + 1);
  190. X      path[l + 1] = '\0';
  191. X   }
  192. X}
  193. X
  194. X/* Delete a timer */
  195. Xstatic void DeleteTimer(struct timerequest *tr)
  196. X{
  197. X   TimerBase = (struct Library *)(-1); /* Don't call any more ! */
  198. X
  199. X   if (tr != NULL)
  200. X   {
  201. X      /* Remove the port */
  202. X      if (tr->tr_node.io_Message.mn_ReplyPort) DeletePort(tr->tr_node.io_Message.mn_ReplyPort);
  203. X
  204. X      CloseDevice((struct IORequest *)tr); /* Close the device */
  205. X      DeleteExtIO((struct IORequest *)tr); /* Free the IO request */
  206. X   }
  207. X}
  208. X
  209. X/* Create a timer of type unit */
  210. Xstatic struct timerequest *CreateTimer(ULONG unit)
  211. X{
  212. X   register long error;
  213. X
  214. X   register struct MsgPort *timerport;
  215. X   register struct timerequest *timermsg;
  216. X
  217. X   if ((timerport = CreatePort(NULL, 0)) == NULL) /* first get a port */
  218. X      return(NULL); /* failed */
  219. X
  220. X   if ((timermsg = (struct timerequest *) /* Then create an IO request for the timer */
  221. X           CreateExtIO(timerport, sizeof(struct timerequest))) == NULL)
  222. X      return(NULL); /* failed */
  223. X
  224. X   if ((error = OpenDevice(TIMERNAME, unit, (struct IORequest *)timermsg, 0)) != 0) /* Finally, open the timer device */
  225. X   { /* failed */
  226. X      DeleteTimer(timermsg);
  227. X      return(NULL);
  228. X   }
  229. X
  230. X   TimerBase = (struct Library *)timermsg->tr_node.io_Device; /* Allow calls to the time arithmetic routines */
  231. X   return(timermsg);
  232. X}
  233. X
  234. X/* Wait for a specified duration */
  235. Xstatic void WaitFor(struct timeval *tv)
  236. X{
  237. X   timer->tr_node.io_Command = TR_ADDREQUEST;
  238. X
  239. X   timer->tr_time = *tv;
  240. X
  241. X   DoIO((struct IORequest *)timer); /* Wait for completion of request */
  242. X}
  243. X
  244. X/* Obtain the system time, assume global timer contains a valid timer */
  245. Xstatic void GetSysTime(struct timeval *tv)
  246. X{
  247. X   timer->tr_node.io_Command = TR_GETSYSTIME;
  248. X   DoIO((struct IORequest *)timer);
  249. X
  250. X   *tv = timer->tr_time; /* Copy obtained time */
  251. X}
  252. X
  253. X/* Reverse the key on the keyboard (as if user was holding it down) */
  254. Xstatic void ReverseKey(int key)
  255. X{
  256. X   register int kx, ky, h;
  257. X
  258. X   if (key == 30) h = KEYHEIGHT - 1; /* ON, higher than average */
  259. X   else if (key == 25) h = MAXHEIGHT + TOPKEYHEIGHT - 1; /* ENTER, even taller */
  260. X   else h = TOPKEYHEIGHT - 1;
  261. X
  262. X/* -------------------- */
  263. X/* Check for bug when using short int */
  264. X
  265. X   kx = (key % 10) * MAXWIDTH + KEYX; /* Calc. key position */
  266. X   ky = (key / 10) * MAXHEIGHT + KEYY;
  267. X
  268. X   SetDrMd(hp11->RPort, COMPLEMENT); /* Draw in reverse */
  269. X   RectFill(hp11->RPort, (long)kx, (long)ky, (long)(kx + (KEYWIDTH - 1)), (long)(ky + h));
  270. X}
  271. X
  272. X/* From positions x & y, deduce which key was pressed */
  273. Xstatic int DecodeKey(int x, int y)
  274. X{
  275. X   register int kx, ky, px, py;
  276. X
  277. X   kx = (x - KEYX) / MAXWIDTH; px = (x - KEYX) % MAXWIDTH;
  278. X   ky = (y - KEYY) / MAXHEIGHT; py = (y - KEYY) % MAXHEIGHT;
  279. X
  280. X   if (/* first, check if in keyboard. x & y are tested (instead of kx, ky)
  281. X      because kx & ky suffer a roundoff towards zero for negative values */
  282. X       (x >= KEYX && y >= KEYY && kx <= 9 && ky <= 3)
  283. X       &&
  284. X      /* now the condition on width */
  285. X       (px < KEYWIDTH && px >= 0) /* same for all keys */
  286. X       &&
  287. X     /* condition on height, 2 cases for ENTER is different */
  288. X       (
  289. X       (kx == 5 && (ky == 2 || (ky == 3 && py < KEYHEIGHT) && (ky = 2))) /* ENTER, set ky to correct value when ky == 3 */
  290. X       || /* condition on height */
  291. X       (py < KEYHEIGHT && py >= 0)
  292. X       )
  293. X      ) return(ky * 10 + kx);
  294. X   else return(-1);
  295. X}
  296. X
  297. X/* Mouse was pressed at x,y. Is this a key ? */
  298. Xstatic int GetMouseKey(int x, int y)
  299. X{
  300. X   int key;
  301. X
  302. X   if ((key = DecodeKey(x, y)) != -1) { /* yes */
  303. X      ReverseKey(key);
  304. X      keytype = mouse; /* info for RelKey() */
  305. X   }
  306. X   return(key);
  307. X}
  308. X
  309. X/* Key keycode was pressed by the user */
  310. Xstatic int GetKeyKey(int _keycode)
  311. X{
  312. X   register int key = -1, keycode = tolower(_keycode);
  313. X
  314. X   switch (keycode) {
  315. X      case ESC: key = 30; break;
  316. X      case '7': case '8': case '9': key = keycode - ('7' - 6); break;
  317. X      case '4': case '5': case '6': key = keycode - ('4' - 16); break;
  318. X      case '1': case '2': case '3': key = keycode - ('1' - 26); break;
  319. X      case '0': key = 36; break;
  320. X      case '.': key = 37; break;
  321. X      case '^': key =  3; break;
  322. X      case '*': key = 19; break;
  323. X      case '-': key = 29; break;
  324. X      case '+': key = 39; break;
  325. X      case '/': key =  9; break;
  326. X      case '_': key =  5; break;
  327. X      case CR : key = 25; break;
  328. X      case 'f': key = 31; break;
  329. X      case 'g': key = 32; break;
  330. X      case BS : key = 24; break;
  331. X      case 's': key = 12; break;
  332. X      case 'c': key = 13; break;
  333. X      case 't': key = 14; break;
  334. X   }
  335. X   if (key != -1) { /* A valid key was given */
  336. X      ReverseKey(key);
  337. X      keytype = keyboard; /* for RelKey() */
  338. X   }
  339. X   return(key);
  340. X}
  341. X
  342. X/* Get a key from the keyboard with/without waiting */
  343. Xint PollKey(wait)
  344. Xint wait;
  345. X{
  346. X   register int key;
  347. X   register struct IntuiMessage *msg;
  348. X   register ULONG class;
  349. X   register UWORD code;
  350. X   register WORD x, y;
  351. X   register APTR address;
  352. X
  353. X   key = -1; /* no key yet */
  354. X   do {
  355. X      if (wait) WaitPort(hp11->UserPort); /* No active waits in multi-tasking ! */
  356. X      msg = (struct IntuiMessage *)GetMsg(hp11->UserPort); /* Get the message if there is one */
  357. X      if (msg) { /* yes, there is */
  358. X     /* Copy relevant information */
  359. X     class = msg->Class;
  360. X     code = msg->Code;
  361. X     address = msg->IAddress;
  362. X     x = msg->MouseX;
  363. X     y = msg->MouseY;
  364. X     secs = msg->Seconds;
  365. X     micros = msg->Micros;
  366. X     ReplyMsg((struct Message *)msg); /* & reply to it */
  367. X
  368. X     switch (class) { /* type of message */
  369. X        case CLOSEWINDOW: /* Window closed = Quit */
  370. X           quit = TRUE;
  371. X           key = BRESET;
  372. X           keytype = gadget;
  373. X           break;
  374. X        case MOUSEBUTTONS: /* A mouse button was pressed */
  375. X           if (code == SELECTDOWN)
  376. X          key = GetMouseKey(x, y);
  377. X           break;
  378. X        case VANILLAKEY: /* a key was pressed */
  379. X           key = GetKeyKey(code);
  380. X           break;
  381. X        case MENUPICK: /* A menu option was chosen */
  382. X           key = MenuHandler(code); /* Call menu handler */
  383. X           keytype = menu; /* for RelKey() */
  384. X           break;
  385. X     }
  386. X      }
  387. X   } while (key == -1 && (msg || wait));
  388. X   /* Exit if key read or, if not waiting, no message ready */
  389. X
  390. X   lastkey = key; /* save key for RelKey() */
  391. X   return(key);
  392. X}
  393. X
  394. X/* Wait for latest key to be released, returns true if button released
  395. X  over key (valid only for mouse) */
  396. XBOOL RelKey()
  397. X{
  398. X   register WORD x, y;
  399. X   register BOOL Released;
  400. X   register struct IntuiMessage *msg;
  401. X   struct timeval event, now, delay;
  402. X   register int key = lastkey; /* key last pressed */
  403. X
  404. X   lastkey = -1; /* Only release it once ! */
  405. X
  406. X   if (key != -1)
  407. X      switch (keytype) {
  408. X
  409. X     case keyboard: /* Key reversed for a max of .08 secs
  410. X        (There is no easy way to wait for its release on the keyboard) */
  411. X        event.tv_secs = secs; event.tv_micro = micros;
  412. X        GetSysTime(&now);
  413. X        SubTime(&now, &event); /* Time elapsed since key pressed */
  414. X        delay.tv_secs = 0; delay.tv_micro = 80000;
  415. X        if (CmpTime(&now, &delay) == 1) { /* now < delay */
  416. X           SubTime(&delay, &now);
  417. X           WaitFor(&delay); /* Wait long enough */
  418. X        }
  419. X        ReverseKey(key); /* un-reverse key */
  420. X        return(TRUE);
  421. X
  422. X     case mouse:
  423. X        Released = FALSE;
  424. X        do { /* Wait for mouse button to be released */
  425. X           WaitPort(hp11->UserPort);
  426. X           msg = (struct IntuiMessage *)GetMsg(hp11->UserPort);
  427. X           x = msg->MouseX;
  428. X           y = msg->MouseY;
  429. X           Released = (msg->Class == MOUSEBUTTONS && msg->Code == SELECTUP);
  430. X           ReplyMsg((struct Message *)msg);
  431. X        } while (!Released);
  432. X        ReverseKey(key); /* un-reverse key */
  433. X
  434. X        return((BOOL)(DecodeKey(x, y) == key)); /* Button released over key? */
  435. X      }
  436. X   return(TRUE); /* if already released */
  437. X}
  438. X
  439. X/* load picture from open file file, width pixel wide, height pixels high,
  440. X  depth bitplanes deep into bitmap bm & colormap cols (if non-null) */
  441. Xstatic BOOL LoadBitMap(LONG file, struct BitMap *bm, int width, int height,
  442. X               int depth)
  443. X{
  444. X   register int i;
  445. X   register LONG nb, plsize;
  446. X
  447. X   InitBitMap(bm, (long)depth, (long)width, (long)height);
  448. X   plsize = bm->BytesPerRow * bm->Rows; /* size of 1 plane */
  449. X   /* Allocate enough memory for all planes, initialise plane pointers */
  450. X   if (!(bm->Planes[0] = (PLANEPTR)AllocMem(plsize * depth, MEMF_CHIP))) return((BOOL) FALSE);
  451. X   for (i = 1; i < depth; i++) bm->Planes[i] = bm->Planes[0] + plsize * i;
  452. X
  453. X   /* Read data from disk */
  454. X   for (i = 0; i < bm->Depth; i++) {
  455. X      nb = Read(file, bm->Planes[i], plsize);
  456. X      if (nb < plsize) return((BOOL) FALSE);
  457. X   }
  458. X
  459. X   return((BOOL) TRUE);
  460. X}
  461. X
  462. Xvoid alert(struct Window *win, char *msg1, char *msg2)
  463. X{
  464. X    static struct TextAttr alert_attr = { "topaz.font", 8 };
  465. X    struct TextFont *alert_font;
  466. X    struct IntuiText text1, text2, negative;
  467. X    const static struct IntuiText template = {
  468. X    0, 1, JAM1,
  469. X    8, 0,
  470. X    &alert_attr
  471. X    };
  472. X    int width, height;
  473. X    int ysize;
  474. X
  475. X    alert_font = OpenFont(&alert_attr);
  476. X
  477. X    ysize = alert_font ? alert_font->tf_YSize : 8;
  478. X
  479. X    text1 = text2 = negative = template;
  480. X    text1.TopEdge = 8;
  481. X    text1.IText = msg1;
  482. X    width = IntuiTextLength(&text1) + 40;
  483. X    height = 37 + 2 * ysize;
  484. X    if (msg2 != NULL)
  485. X    {
  486. X    int w;
  487. X
  488. X    text1.NextText = &text2;
  489. X    text2.TopEdge = text1.TopEdge + ysize;
  490. X    text2.IText = msg2;
  491. X
  492. X    height += ysize;
  493. X    w = IntuiTextLength(&text2) + 20;
  494. X    if (w > width) width = w;
  495. X    }
  496. X    negative.LeftEdge = 6;
  497. X    negative.TopEdge = 4;
  498. X    negative.IText = "Ok";
  499. X
  500. X    AutoRequest(win, &text1, NULL, &negative, 0L, 0L, width, height);
  501. X}
  502. X
  503. X/* Amiga specific initialisation */
  504. X#define argw ((struct WBStartup *)argv)
  505. XBOOL AmigaInit(argc, argv)
  506. Xint argc;
  507. XAPTR argv;
  508. X{
  509. X   register LONG file;
  510. X   register BOOL loaded;
  511. X   struct BitMap hp11bitmap;
  512. X   BPTR hp11dir, old;
  513. X   char filename[PATHLEN + 8];
  514. X
  515. X   if (!(GfxBase = (struct GfxBase *)OpenLibrary("graphics.library", 33))) /* Open graphics library (1.2) */
  516. X      return(FALSE);
  517. X
  518. X   if (!(IntuitionBase = (struct IntuitionBase *)OpenLibrary("intuition.library", 33))) /* Open intuition library (1.2) */
  519. X      return(FALSE);
  520. X
  521. X   if (!(LayersBase = (struct LayersBase *)OpenLibrary("layers.library", 0)))
  522. X      return(FALSE);
  523. X
  524. X   /* Find path to command (if possible) */
  525. X   if (argc == 0) /* WB */
  526. X   {
  527. X      old = CurrentDir(argw->sm_ArgList[0].wa_Lock);
  528. X      split(argw->sm_ArgList[0].wa_Name, hp11path, &hp11name);
  529. X      hp11dir = Lock(hp11path, ACCESS_READ);
  530. X      if (!mygetpath(hp11path, hp11dir)) hp11path[0] = '\0';
  531. X      CurrentDir(old);
  532. X      UnLock(hp11dir);
  533. X   }
  534. X   else
  535. X   { /* CLI */
  536. X      split(((char **)argv)[0], hp11path, &hp11name);
  537. X   }
  538. X
  539. X   /* Read the picture */
  540. X   if (!(file = Open(strcat(strcpy(filename, hp11path), "hp11.pic"), MODE_OLDFILE)))
  541. X      if (!(file = Open("hp11.pic", MODE_OLDFILE)))
  542. X      {
  543. X     alert(NULL, "Can't find hp11.pic", NULL);
  544. X     return(FALSE);
  545. X      }
  546. X   loaded = LoadBitMap(file, &hp11bitmap, HP11WIDTH, HP11HEIGHT, 2);
  547. X   Close(file);
  548. X   if (!loaded) return(FALSE);
  549. X
  550. X   /* Open the window */
  551. X   if (!(hp11 = OpenWindow(&hp11new))) return(FALSE);
  552. X
  553. X   /* Move picture into window */
  554. X   BltBitMapRastPort(&hp11bitmap, 0, 0, hp11->RPort, HP11X, HP11Y, HP11WIDTH, HP11HEIGHT, COPY);
  555. X   FreeMem(hp11bitmap.Planes[0], (long)(hp11bitmap.BytesPerRow * hp11bitmap.Rows * hp11bitmap.Depth));
  556. X
  557. X   /* Create timer */
  558. X   if ((timer = CreateTimer(UNIT_MICROHZ)) == NULL) return(FALSE);
  559. X
  560. X   /* Init menus */
  561. X   return(MenusInit(argc, argv));
  562. X}
  563. X#undef argw
  564. X
  565. Xvoid AmigaCleanUp()
  566. X{
  567. X   MenusCleanUp();
  568. X   if (timer) DeleteTimer(timer); /* Close timer */
  569. X   if (hp11) CloseWindow(hp11);
  570. X   if (LayersBase) CloseLibrary((struct Library *)LayersBase);
  571. X   if (IntuitionBase) CloseLibrary((struct Library *)IntuitionBase); /* Close libraries */
  572. X   if (GfxBase) CloseLibrary((struct Library *)GfxBase);
  573. X}
  574. X
  575. X/* Display s */
  576. Xvoid Display(s)
  577. Xregister char *s;
  578. X{
  579. X   register int posx;
  580. X   register int chr;
  581. X   register struct RastPort *rport = hp11->RPort;
  582. X
  583. X   /* Clear display */
  584. X   SetDrMd(rport, JAM1); SetAPen(rport, 2);
  585. X   RectFill(rport, SCRX0 + 1, SCRY0, SCRX1 - 1, SCRY1);
  586. X
  587. X   /* Initial position */
  588. X   posx = SCRX0 + CHAROFFX;
  589. X
  590. X   while (*s) {
  591. X      switch (*s) { /* Position of char in char array */
  592. X     case '0': case '1': case '2': case '3': case '4': case '5': case '6':
  593. X     case '7': case '8': case '9': chr = *s - '0'; break;
  594. X     case '-': chr = 10; break;
  595. X     case 'E': chr = 11; break;
  596. X     case 'r': chr = 12; break;
  597. X     case 'o': chr = 13; break;
  598. X     case 'R': chr = 14; break;
  599. X     case 'u': chr = 15; break;
  600. X     case 'n': chr = 16; break;
  601. X     case 'i': chr = 17; break;
  602. X     case 'g': chr = 18; break;
  603. X     case '.': chr = 19; break;
  604. X     case ',': chr = 20; break;
  605. X     case 'P': chr = 21; break;
  606. X     default:  chr = -1; break;
  607. X      }
  608. X      if (chr != -1)
  609. X     DrawBorder(rport, hp11char[chr], (long)posx, SCRY0 + CHAROFFY);
  610. X
  611. X      if (*s != '.' && *s != ',') posx += CHARWIDTH;
  612. X
  613. X      s++;
  614. X   }
  615. X}
  616. X
  617. X/* Set image to be drawn/erased according to on */
  618. Xstatic void SetCol(struct Image *im, int on)
  619. X{
  620. X   if (on) {
  621. X      im->PlanePick = 3;
  622. X      im->PlaneOnOff = 0;
  623. X   }
  624. X   else {
  625. X      im->PlanePick = 0;
  626. X      im->PlaneOnOff = 2;
  627. X   }
  628. X}
  629. X
  630. X/* Display the indicators */
  631. Xvoid Dispf(on)
  632. Xint on;
  633. X{
  634. X   SetCol(&fImage, on);
  635. X   DrawImage(hp11->RPort, &fImage, fX, INDICY);
  636. X}
  637. X
  638. Xvoid Dispg(on)
  639. Xint on;
  640. X{
  641. X   SetCol(&gImage, on);
  642. X   DrawImage(hp11->RPort, &gImage, gX, INDICY);
  643. X}
  644. X
  645. Xvoid DispUSER(on)
  646. Xint on;
  647. X{
  648. X   SetCol(&USERImage, on);
  649. X   DrawImage(hp11->RPort, &USERImage, USERX, INDICY);
  650. X}
  651. X
  652. Xvoid DispG(on)
  653. Xint on;
  654. X{
  655. X   SetCol(&GImage, on);
  656. X   DrawImage(hp11->RPort, &GImage, GX, INDICY);
  657. X}
  658. X
  659. Xvoid DispRAD(on)
  660. Xint on;
  661. X{
  662. X   SetCol(&RADImage, on);
  663. X   DrawImage(hp11->RPort, &RADImage, RADX, INDICY);
  664. X}
  665. X
  666. Xvoid DispPRGM(on)
  667. Xint on;
  668. X{
  669. X   SetCol(&PRGMImage, on);
  670. X   DrawImage(hp11->RPort, &PRGMImage, PRGMX, INDICY);
  671. X}
  672. X
  673. Xvoid beep(void)
  674. X{
  675. X   DisplayBeep(NULL);
  676. X}
  677. X
  678. Xstatic struct Window *MakeIcon(struct Image *image,
  679. X                   struct BitMap *bm, struct BitMap *tmpbm,
  680. X                   LONG x, LONG y, LONG w, LONG h)
  681. X{
  682. X   register struct Window *win;
  683. X   register ULONG size;
  684. X   static struct NewWindow new_win =
  685. X   { 0, 0, 0, 0, -1, -1, MOUSEBUTTONS | MOUSEMOVE | INACTIVEWINDOW | NOCAREREFRESH,
  686. X     SMART_REFRESH | BORDERLESS | REPORTMOUSE | RMBTRAP,
  687. X     NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, WBENCHSCREEN };
  688. X
  689. X   new_win.LeftEdge = x; new_win.TopEdge = y;
  690. X   new_win.Width = w; new_win.Height = h;
  691. X
  692. X   InitBitMap(bm, 2, w, h);
  693. X   size = bm->BytesPerRow * bm->Rows; /* size of 1 plane */
  694. X   bm->Planes[0] = (PLANEPTR)image->ImageData;
  695. X   bm->Planes[1] = (PLANEPTR)(image->ImageData) + size;
  696. X
  697. X   InitBitMap(tmpbm, 2, w, h);
  698. X   if (!(tmpbm->Planes[0] = (PLANEPTR)AllocMem(2 * size, MEMF_CHIP)))
  699. X     return(NULL);
  700. X   tmpbm->Planes[1] = tmpbm->Planes[0] + size;
  701. X
  702. X   if (win = OpenWindow(&new_win)) DrawImage(win->RPort, image, 0, 0);
  703. X   else FreeMem(tmpbm->Planes[0], 2 * size);
  704. X
  705. X   return(win);
  706. X}
  707. X
  708. Xstatic void GetBounds(struct Window *win, LONG *mx, LONG *my,
  709. X              LONG w, LONG h, LONG wx, LONG wy)
  710. X{
  711. X   struct Screen *scr = win->WScreen;
  712. X
  713. X   *mx = scr->MouseX - wx; *my = scr->MouseY - wy;
  714. X   if (*mx + w > scr->Width) *mx = scr->Width - w;
  715. X   else if (*mx < 0) *mx = 0;
  716. X   if (*my + h > scr->Height) *my = scr->Height - h;
  717. X   else if (*my < 0) *my = 0;
  718. X}
  719. X
  720. Xstatic void SwapImage(struct BitMap *scrbm, struct BitMap *drawing,
  721. X              struct BitMap *buf, LONG x, LONG y, LONG w, LONG h)
  722. X{
  723. X   BltBitMap(scrbm, x, y, buf, 0, 0, w, h, COPY, 0xff, NULL);
  724. X   BltBitMap(drawing, 0, 0, scrbm, x, y, w, h, COPY, 0xff, NULL);
  725. X   BltBitMap(buf, 0, 0, drawing, 0, 0, w, h, COPY, 0xff, NULL);
  726. X}
  727. X
  728. Xstatic void Iconize(struct Image *image, LONG x, LONG y)
  729. X{
  730. X   register struct Window *win;
  731. X   register struct Screen *scr;
  732. X   register struct IntuiMessage *msg;
  733. X   LONG mx, my, wx, wy;
  734. X   register LONG w, h;
  735. X   ULONG oldsecs = 0, oldmicros = 0;
  736. X   BOOL cont, moved;
  737. X   register BOOL down, wasdown;
  738. X   struct BitMap image_bm, tmpbm;
  739. X
  740. X   w = image->Width; h = image->Height;
  741. X   win = MakeIcon(image, &image_bm, &tmpbm, x, y, w, h);
  742. X   if (win)
  743. X   {
  744. X      scr = win->WScreen;
  745. X      cont = TRUE;
  746. X      down = FALSE;
  747. X      do {
  748. X     moved = FALSE; wasdown = down;
  749. X     WaitPort(win->UserPort);
  750. X     while (msg = (struct IntuiMessage *)GetMsg(win->UserPort))
  751. X     {
  752. X        switch (msg->Class)
  753. X        {
  754. X           case MOUSEBUTTONS:
  755. X          if (msg->Code == SELECTUP)
  756. X          {
  757. X             if (DoubleClick(oldsecs, oldmicros, msg->Seconds, msg->Micros))
  758. X            cont = FALSE;
  759. X             else {
  760. X            oldsecs = msg->Seconds;
  761. X            oldmicros = msg->Micros;
  762. X             }
  763. X          }
  764. X          down = (msg->Code == SELECTDOWN);
  765. X          break;
  766. X           case INACTIVEWINDOW: down = FALSE; break;
  767. X           case MOUSEMOVE: moved = TRUE; break;
  768. X        }
  769. X        ReplyMsg((struct Message *)msg);
  770. X     }
  771. X     if (!wasdown && down)
  772. X     {
  773. X        wx = win->MouseX; wy = win->MouseY;
  774. X        GetBounds(win, &mx, &my, w, h, wx, wy);
  775. X        LockLayers(&scr->LayerInfo);
  776. X        SwapImage(&scr->BitMap, &image_bm, &tmpbm, mx, my, w, h);
  777. X     }
  778. X     else if (wasdown)
  779. X        if (down)
  780. X        {
  781. X           if (moved)
  782. X           {
  783. X          SwapImage(&scr->BitMap, &image_bm, &tmpbm, mx, my, w, h);
  784. X          GetBounds(win, &mx, &my, w, h, wx, wy);
  785. X          SwapImage(&scr->BitMap, &image_bm, &tmpbm, mx, my, w, h);
  786. X           }
  787. X        }
  788. X        else
  789. X        {
  790. X           SwapImage(&scr->BitMap, &image_bm, &tmpbm, mx, my, w, h);
  791. X           UnlockLayers(&scr->LayerInfo);
  792. X           MoveWindow(win, (long)(mx - win->LeftEdge), (long)(my - win->TopEdge));
  793. X        }
  794. X      } while (cont || down);
  795. X
  796. X      CloseWindow(win);
  797. X      FreeMem(tmpbm.Planes[0], 2 * RASSIZE(w, h));
  798. X   }
  799. X}
  800. X
  801. Xvoid sleep()
  802. X{
  803. X   struct BitMap hp11bitmap;
  804. X   struct RastPort hp11rport;
  805. X   register LONG plsize;
  806. X   register LONG x, y;
  807. X
  808. X   /* Save picture in bitmap */
  809. X   InitBitMap(&hp11bitmap, 2, HP11WIDTH, HP11HEIGHT);
  810. X   plsize = hp11bitmap.BytesPerRow * hp11bitmap.Rows; /* size of 1 plane */
  811. X   /* Allocate enough memory for all planes, initialise plane pointers */
  812. X   if (!(hp11bitmap.Planes[0] = (PLANEPTR)AllocMem(plsize * 2, MEMF_CHIP)))
  813. X      Message("Not enough memory");
  814. X   else
  815. X   {
  816. X      hp11bitmap.Planes[1] = hp11bitmap.Planes[0] + plsize;
  817. X      InitRastPort(&hp11rport);
  818. X      hp11rport.BitMap = &hp11bitmap;
  819. X      ClipBlit(hp11->RPort, HP11X, HP11Y, &hp11rport, 0, 0,
  820. X           HP11WIDTH, HP11HEIGHT, COPY);
  821. X      Forbid();
  822. X      x = hp11->LeftEdge; y = hp11->TopEdge;
  823. X      Permit();
  824. X      ClearMenuStrip(hp11);
  825. X      CloseWindow(hp11);
  826. X
  827. X      Iconize(&off_image, x, y);
  828. X
  829. X      /* Open the window */
  830. X      hp11new.LeftEdge = x; hp11new.TopEdge = y;
  831. X      if (!(hp11 = OpenWindow(&hp11new)))
  832. X      {
  833. X     AutoRequest(NULL, &nomemtext, NULL, &canceltext, NULL, NULL, 250, 60);
  834. X     quit = TRUE;
  835. X      }
  836. X      else {
  837. X     /* Move picture into window */
  838. X     BltBitMapRastPort(&hp11bitmap, 0, 0, hp11->RPort, HP11X, HP11Y, HP11WIDTH, HP11HEIGHT, COPY);
  839. X     FreeMem(hp11bitmap.Planes[0], (long)(hp11bitmap.BytesPerRow * hp11bitmap.Rows * hp11bitmap.Depth));
  840. X     SetMenuStrip(hp11, hp11menu);
  841. X     on = TRUE;
  842. X      }
  843. X   }
  844. X}
  845. X
  846. SHAR_EOF
  847. echo "extracting amiga/amiga.h"
  848. sed 's/^X//' << \SHAR_EOF > amiga/amiga.h
  849. X/* These are the computer specific routines which must be rewritten on a
  850. X  different computer */
  851. Xvoid AmigaCleanUp(void); /* CleanUp before exiting, eg make the hp11 disappear,
  852. X  deallocate any memory it took ... This is called by the main CleanUp routine */
  853. X
  854. XBOOL AmigaInit(int, APTR); /* Prepare the HP11 for use (eg display it). This is called
  855. X  by the main Init routine */
  856. X
  857. Xvoid Display(char *); /* Display the argument in the display.
  858. X  Valid chars are 0..9 . , - E r o R u n i g
  859. X  Any other chars are displayed as a space, . & , take no space in the
  860. X  display (which is 11 chars long). */
  861. X
  862. Xint PollKey(int); /* Read a key from the HP11 keyboard.
  863. X  if the argument is TRUE, wait for one to be pressed otherwise return -1 if
  864. X  none is yet available.
  865. X  The value returned is from 0 to 39 (-1 for no key) */
  866. X
  867. X/* Display the various indicators : TRUE to display, FALSE to erase */
  868. Xvoid Dispf(int), Dispg(int), DispUSER(int), DispG(int),
  869. X     DispRAD(int), DispPRGM(int);
  870. X
  871. XBOOL RelKey(void); /* Wait for the latest key (read by PollKey) to be released */
  872. X
  873. X/* Enable/Disable any clipboard style editing facilities (if provided) */
  874. Xvoid EditOn(void), EditOff(void);
  875. X
  876. X/* Provide only if you want seomething special to happen while the HP11 is
  877. X  off. There is a default version in hp11.c */
  878. Xvoid sleep(void);
  879. X
  880. X/* Wait n 50ths of a second. Here simply defined ... */
  881. X#define Wait50 Delay
  882. Xvoid Delay(long);
  883. X
  884. X/* These routines are actually in menus.c */
  885. Xvoid MenusOn(void), MenusOff(void);
  886. X
  887. X
  888. SHAR_EOF
  889. echo "extracting amiga/cbio.c"
  890. sed 's/^X//' << \SHAR_EOF > amiga/cbio.c
  891. X#include <proto/exec.h>
  892. X#include <exec/io.h>
  893. X#include <devices/clipboard.h>
  894. X#include <iff/iff.h>
  895. X#include "user/cbio.h"
  896. X
  897. X#include <string.h>
  898. X
  899. X#define FTXT MakeID('F','T','X','T')
  900. X#define CHRS MakeID('C','H','R','S')
  901. X
  902. Xstruct IOClipReq *clipboardIO;
  903. Xstruct MsgPort *clipboardMsgPort;
  904. X
  905. Xlong CBOpen(long unit)
  906. X{
  907. X   long error;
  908. X
  909. X   if ((clipboardMsgPort = CreatePort(0, 0)) == 0) return(-1);
  910. X
  911. X   if ((clipboardIO = (struct IOClipReq *)CreateExtIO(clipboardMsgPort, sizeof(struct IOClipReq))) == 0) {
  912. X      DeletePort(clipboardMsgPort);
  913. X      return(-1);
  914. X   }
  915. X
  916. X   if ((error = OpenDevice("clipboard.device", unit, (struct IORequest *)clipboardIO, 0)) != 0) {
  917. X      DeleteExtIO((struct IORequest *)clipboardIO, sizeof(struct IOClipReq));
  918. X      DeletePort(clipboardMsgPort);
  919. X      return(error);
  920. X   }
  921. X
  922. X   return(0);
  923. X}
  924. X
  925. Xvoid CBClose(void)
  926. X{
  927. X   if (clipboardIO) {
  928. X      CloseDevice((struct IORequest *)clipboardIO);
  929. X      DeleteExtIO((struct IORequest *)clipboardIO, sizeof(struct IOClipReq));
  930. X   }
  931. X   if (clipboardMsgPort) DeletePort(clipboardMsgPort);
  932. X}
  933. X
  934. Xvoid CBWrite(void *data, int length)
  935. X{
  936. X   clipboardIO->io_Command = CMD_WRITE;
  937. X   clipboardIO->io_Data = data;
  938. X   clipboardIO->io_Length = length;
  939. X   DoIO((struct IORequest *)clipboardIO);
  940. X}
  941. X
  942. X
  943. Xvoid CBCut(char *text)
  944. X{
  945. X   ID writeID;
  946. X   long ifflen;
  947. X   int len = strlen(text);
  948. X
  949. X   clipboardIO->io_Offset = 0;
  950. X   clipboardIO->io_ClipID = 0;
  951. X
  952. X   writeID = FORM;
  953. X   CBWrite(&writeID, 4);
  954. X
  955. X   ifflen = len + 12;
  956. X   CBWrite(&ifflen, 4);
  957. X
  958. X   writeID = FTXT;
  959. X   CBWrite(&writeID, 4);
  960. X
  961. X   writeID = CHRS;
  962. X   CBWrite(&writeID, 4);
  963. X
  964. X   CBWrite(&len, 4);
  965. X   CBWrite(text, len);
  966. X
  967. X   clipboardIO->io_Command = CMD_UPDATE;
  968. X   DoIO((struct IORequest *)clipboardIO);
  969. X}
  970. X
  971. XBYTE *CBRead(void *data, int length)
  972. X{
  973. X   clipboardIO->io_Command = CMD_READ;
  974. X   clipboardIO->io_Data = data;
  975. X   clipboardIO->io_Length = length;
  976. X   DoIO((struct IORequest *)clipboardIO);
  977. X
  978. X   return(data);
  979. X}
  980. X
  981. XBOOL CBPaste(char *string)
  982. X{
  983. X   long length;
  984. X   BOOL success = FALSE;
  985. X   ID check;
  986. X
  987. X   clipboardIO->io_ClipID = 0;
  988. X   clipboardIO->io_Offset = 0;
  989. X
  990. X   CBRead(&check, 4);
  991. X   if (check == FORM) {
  992. X
  993. X      CBRead(&check, 4);
  994. X      CBRead(&check, 4);
  995. X      if (check == FTXT) {
  996. X
  997. X     CBRead(&check, 4);
  998. X     if (check == CHRS) {
  999. X
  1000. X        CBRead(&length, 4);
  1001. X        CBRead(string, length);
  1002. X        string[length] = '\0';
  1003. X        success = TRUE;
  1004. X     }
  1005. X      }
  1006. X   }
  1007. X
  1008. X   while (clipboardIO->io_Actual != 0)
  1009. X      CBRead(NULL, 1 << 30);
  1010. X
  1011. X   return(success);
  1012. X}
  1013. SHAR_EOF
  1014. echo "extracting amiga/cbio.h"
  1015. sed 's/^X//' << \SHAR_EOF > amiga/cbio.h
  1016. Xextern long __stdargs CBOpen(long);
  1017. Xextern void __stdargs CBClose(void);
  1018. Xextern void __stdargs CBCut(char *);
  1019. Xextern BOOL __stdargs CBPaste(char *);
  1020. X
  1021. SHAR_EOF
  1022. echo "extracting amiga/chars.c"
  1023. sed 's/^X//' << \SHAR_EOF > amiga/chars.c
  1024. X/* this defines the character shapes */
  1025. X#include "exec/types.h"
  1026. X#include "intuition/intuition.h"
  1027. X
  1028. X/* First the shape of the seven segments + point & comma.
  1029. X  They are defined in a 14x13 box and are drawn by a series of lines.
  1030. X  The offsets are relative to the top left corner of this box */
  1031. Xstatic WORD top[] = {
  1032. X   4,0,
  1033. X   10,0,
  1034. X   9,1,
  1035. X   5,1
  1036. X};
  1037. Xstatic WORD ctr[] = {
  1038. X   4,6,
  1039. X   10,6,
  1040. X   10,7,
  1041. X   4,7,
  1042. X};
  1043. Xstatic WORD bottom[] = {
  1044. X   5,12,
  1045. X   9,12,
  1046. X   10,13,
  1047. X   4,13
  1048. X};
  1049. Xstatic WORD tl[] = {
  1050. X   3,1,
  1051. X   3,6,
  1052. X   4,5,
  1053. X   4,1
  1054. X};
  1055. Xstatic WORD tr[] = {
  1056. X   11,1,
  1057. X   11,6,
  1058. X   10,5,
  1059. X   10,1
  1060. X};
  1061. Xstatic WORD bl[] = {
  1062. X   3,7,
  1063. X   3,12,
  1064. X   4,12,
  1065. X   4,8
  1066. X};
  1067. Xstatic WORD br[] = {
  1068. X   11,7,
  1069. X   11,12,
  1070. X   10,12,
  1071. X   10,8
  1072. X};
  1073. Xstatic WORD pt[] = {
  1074. X   -1,12,
  1075. X   0,12,
  1076. X   0,13,
  1077. X   -1,13
  1078. X};
  1079. Xstatic WORD com[] = {
  1080. X   0,14,
  1081. X   -1,14,
  1082. X   -1,15,
  1083. X   -2,15
  1084. X};
  1085. X
  1086. X/* Character definitions, they are composed of the seven segments */
  1087. Xstatic struct Border zero[] = {
  1088. X{ 0, 0, 1, 2, JAM1, 4, top, &zero[1] },
  1089. X{ 0, 0, 1, 2, JAM1, 4, tl, &zero[2] },
  1090. X{ 0, 0, 1, 2, JAM1, 4, tr, &zero[3] },
  1091. X{ 0, 0, 1, 2, JAM1, 4, bl, &zero[4] },
  1092. X{ 0, 0, 1, 2, JAM1, 4, br, &zero[5] },
  1093. X{ 0, 0, 1, 2, JAM1, 4, bottom, NULL }
  1094. X};
  1095. Xstatic struct Border one[] = {
  1096. X{ 0, 0, 1, 2, JAM1, 4, tr, &one[1] },
  1097. X{ 0, 0, 1, 2, JAM1, 4, br, NULL }
  1098. X};
  1099. Xstatic struct Border two[] = {
  1100. X{ 0, 0, 1, 2, JAM1, 4, top, &two[1] },
  1101. X{ 0, 0, 1, 2, JAM1, 4, tr, &two[2] },
  1102. X{ 0, 0, 1, 2, JAM1, 4, ctr, &two[3] },
  1103. X{ 0, 0, 1, 2, JAM1, 4, bl, &two[4] },
  1104. X{ 0, 0, 1, 2, JAM1, 4, bottom, NULL }
  1105. X};
  1106. Xstatic struct Border three[] = {
  1107. X{ 0, 0, 1, 2, JAM1, 4, top, &three[1] },
  1108. X{ 0, 0, 1, 2, JAM1, 4, ctr, &three[2] },
  1109. X{ 0, 0, 1, 2, JAM1, 4, bottom, &three[3] },
  1110. X{ 0, 0, 1, 2, JAM1, 4, tr, &three[4] },
  1111. X{ 0, 0, 1, 2, JAM1, 4, br, NULL }
  1112. X};
  1113. Xstatic struct Border four[] = {
  1114. X{ 0, 0, 1, 2, JAM1, 4, tr, &four[1] },
  1115. X{ 0, 0, 1, 2, JAM1, 4, tl, &four[2] },
  1116. X{ 0, 0, 1, 2, JAM1, 4, br, &four[3] },
  1117. X{ 0, 0, 1, 2, JAM1, 4, ctr, NULL }
  1118. X};
  1119. Xstatic struct Border five[] = {
  1120. X{ 0, 0, 1, 2, JAM1, 4, top, &five[1] },
  1121. X{ 0, 0, 1, 2, JAM1, 4, ctr, &five[2] },
  1122. X{ 0, 0, 1, 2, JAM1, 4, bottom, &five[3] },
  1123. X{ 0, 0, 1, 2, JAM1, 4, tl, &five[4] },
  1124. X{ 0, 0, 1, 2, JAM1, 4, br, NULL }
  1125. X};
  1126. Xstatic struct Border six[] = {
  1127. X{ 0, 0, 1, 2, JAM1, 4, top, &six[1] },
  1128. X{ 0, 0, 1, 2, JAM1, 4, ctr, &six[2] },
  1129. X{ 0, 0, 1, 2, JAM1, 4, bottom, &six[3] },
  1130. X{ 0, 0, 1, 2, JAM1, 4, tl, &six[4] },
  1131. X{ 0, 0, 1, 2, JAM1, 4, bl, &six[5] },
  1132. X{ 0, 0, 1, 2, JAM1, 4, br, NULL }
  1133. X};
  1134. Xstatic struct Border seven[] = {
  1135. X{ 0, 0, 1, 2, JAM1, 4, top, &seven[1] },
  1136. X{ 0, 0, 1, 2, JAM1, 4, tr, &seven[2] },
  1137. X{ 0, 0, 1, 2, JAM1, 4, br, NULL }
  1138. X};
  1139. Xstatic struct Border eight[] = {
  1140. X{ 0, 0, 1, 2, JAM1, 4, top, &eight[1] },
  1141. X{ 0, 0, 1, 2, JAM1, 4, ctr, &eight[2] },
  1142. X{ 0, 0, 1, 2, JAM1, 4, bottom, &eight[3] },
  1143. X{ 0, 0, 1, 2, JAM1, 4, tl, &eight[4] },
  1144. X{ 0, 0, 1, 2, JAM1, 4, tr, &eight[5] },
  1145. X{ 0, 0, 1, 2, JAM1, 4, bl, &eight[6] },
  1146. X{ 0, 0, 1, 2, JAM1, 4, br, NULL }
  1147. X};
  1148. Xstatic struct Border nine[] = {
  1149. X{ 0, 0, 1, 2, JAM1, 4, top, &nine[1] },
  1150. X{ 0, 0, 1, 2, JAM1, 4, ctr, &nine[2] },
  1151. X{ 0, 0, 1, 2, JAM1, 4, bottom, &nine[3] },
  1152. X{ 0, 0, 1, 2, JAM1, 4, tl, &nine[4] },
  1153. X{ 0, 0, 1, 2, JAM1, 4, tr, &nine[5] },
  1154. X{ 0, 0, 1, 2, JAM1, 4, br, NULL }
  1155. X};
  1156. Xstatic struct Border minus[] = {
  1157. X{ 0, 0, 1, 2, JAM1, 4, ctr, NULL }
  1158. X};
  1159. Xstatic struct Border E[] = {
  1160. X{ 0, 0, 1, 2, JAM1, 4, top, &E[1] },
  1161. X{ 0, 0, 1, 2, JAM1, 4, ctr, &E[2] },
  1162. X{ 0, 0, 1, 2, JAM1, 4, bottom, &E[3] },
  1163. X{ 0, 0, 1, 2, JAM1, 4, tl, &E[4] },
  1164. X{ 0, 0, 1, 2, JAM1, 4, bl, NULL }
  1165. X};
  1166. Xstatic struct Border r[] = {
  1167. X{ 0, 0, 1, 2, JAM1, 4, ctr, &r[1] },
  1168. X{ 0, 0, 1, 2, JAM1, 4, bl, NULL }
  1169. X};
  1170. Xstatic struct Border o[] = {
  1171. X{ 0, 0, 1, 2, JAM1, 4, ctr, &o[1] },
  1172. X{ 0, 0, 1, 2, JAM1, 4, bottom, &o[2] },
  1173. X{ 0, 0, 1, 2, JAM1, 4, bl, &o[3] },
  1174. X{ 0, 0, 1, 2, JAM1, 4, br, NULL }
  1175. X};
  1176. Xstatic struct Border R[] = {
  1177. X{ 0, 0, 1, 2, JAM1, 4, top, &R[1] },
  1178. X{ 0, 0, 1, 2, JAM1, 4, tl, NULL }
  1179. X};
  1180. Xstatic struct Border u[] = {
  1181. X{ 0, 0, 1, 2, JAM1, 4, tl, &u[1] },
  1182. X{ 0, 0, 1, 2, JAM1, 4, tr, &u[2] },
  1183. X{ 0, 0, 1, 2, JAM1, 4, ctr, NULL }
  1184. X};
  1185. Xstatic struct Border n[] = {
  1186. X{ 0, 0, 1, 2, JAM1, 4, top, &n[1] },
  1187. X{ 0, 0, 1, 2, JAM1, 4, tl, &n[2] },
  1188. X{ 0, 0, 1, 2, JAM1, 4, tr, NULL },
  1189. X};
  1190. Xstatic struct Border i[] = {
  1191. X{ 0, 0, 1, 2, JAM1, 4, tr, NULL },
  1192. X};
  1193. Xstatic struct Border point[] = {
  1194. X{ 0, 0, 1, 2, JAM1, 4, pt, NULL },
  1195. X};
  1196. Xstatic struct Border comma[] = {
  1197. X{ 0, 0, 1, 2, JAM1, 4, pt, &comma[1] },
  1198. X{ 0, 0, 1, 2, JAM1, 4, com, NULL }
  1199. X};
  1200. Xstatic struct Border P[] = {
  1201. X{ 0, 0, 1, 2, JAM1, 4, top, &P[1] },
  1202. X{ 0, 0, 1, 2, JAM1, 4, ctr, &P[2] },
  1203. X{ 0, 0, 1, 2, JAM1, 4, tr, &P[3] },
  1204. X{ 0, 0, 1, 2, JAM1, 4, tl, &P[4] },
  1205. X{ 0, 0, 1, 2, JAM1, 4, bl, NULL }
  1206. X};
  1207. X
  1208. X/* The character array, visible to the exterior */
  1209. Xstruct Border *hp11char[] = {
  1210. X  zero, one, two, three, four, five, six, seven, eight, nine,
  1211. X  minus, E, r, o, R, u, n, i, nine /* g */, point, comma, P };
  1212. X
  1213. SHAR_EOF
  1214. echo "extracting amiga/chip.c"
  1215. sed 's/^X//' << \SHAR_EOF > amiga/chip.c
  1216. X#include "exec/types.h"
  1217. X
  1218. XUWORD chip fData[] = {
  1219. X   0x2000, 0x4000, 0xE000, 0x4000, 0x4000, 0x4000,
  1220. X   0xDFFF, 0xBFFF, 0x1FFF, 0xBFFF, 0xBFFF, 0xBFFF
  1221. X};
  1222. X/*   X */
  1223. X/*  X  */
  1224. X/* XXX */
  1225. X/*  X  */
  1226. X/*  X  */
  1227. X/*  X  */
  1228. X
  1229. XUWORD chip gData[] = {
  1230. X   0x7000, 0x9000, 0x9000, 0x7000, 0x1000, 0xE000,
  1231. X   0x8FFF, 0x6FFF, 0x6FFF, 0x8FFF, 0xEFFF, 0x1FFF
  1232. X};
  1233. X/*  XXX */
  1234. X/* X  X */
  1235. X/* X  X */
  1236. X/*  XXX */
  1237. X/*    X */
  1238. X/* XXX    */
  1239. X
  1240. XUWORD chip GData[] = {
  1241. X   0x6000, 0x9000, 0x8000, 0xB000, 0x9000, 0x6000,
  1242. X   0x9FFF, 0x6FFF, 0x7FFF, 0x4FFF, 0x6FFF, 0x9FFF
  1243. X};
  1244. X/*  XX    */
  1245. X/* X  X */
  1246. X/* X    */
  1247. X/* X XX */
  1248. X/* X  X */
  1249. X/*  XX    */
  1250. X
  1251. XUWORD chip RADData[] = {
  1252. X   0xE338, 0x94A4, 0x94A4, 0xE7A4, 0xA4A4, 0x94B8,
  1253. X   0x1CC7, 0x6B5B, 0x6B5B, 0x185B, 0x5B5B, 0x6B47
  1254. X};
  1255. X/* XXX     XX  XXX  */
  1256. X/* X  X X  X X    X */
  1257. X/* X  X X  X X    X */
  1258. X/* XXX    XXXX X    X */
  1259. X/* X X    X  X X    X */
  1260. X/* X  X X  X XXX  */
  1261. X
  1262. XUWORD chip PRGMData[] = {
  1263. X   0xE719, 0x2000,  0x94A5, 0xE000,  0x94A1, 0x2000,  0xE72D, 0x2000,  0x8525, 0x2000,    0x8499, 0x2000,
  1264. X   0x18E6, 0xDFFF,  0x6B5A, 0x1FFF,  0x6B5E, 0xDFFF,  0x18D2, 0xDFFF,  0x7ADA, 0xDFFF,    0x7B66, 0xDFFF
  1265. X};
  1266. X/* XXX    XXX   XX  X  X */
  1267. X/* X  X X  X X    X XXXX */
  1268. X/* X  X X  X X      X  X */
  1269. X/* XXX    XXX  X XX X  X */
  1270. X/* X    X X  X    X X  X */
  1271. X/* X    X  X  XX  X  X */
  1272. X
  1273. XUWORD chip USERData[] = {
  1274. X   0x933D, 0xC000,  0x94A1, 0x2000,  0x9239, 0x2000,  0x9121, 0xC000,  0x94A1, 0x4000,    0x633D, 0x2000,
  1275. X   0x6CC2, 0x3FFF,  0x6B5E, 0xDFFF,  0x6DC6, 0xDFFF,  0x6EDE, 0x3FFF,  0x6B5E, 0xBFFF,    0x9CC2, 0xDFFF
  1276. X};
  1277. X
  1278. X/* X  X  XX  XXXX XXX  */
  1279. X/* X  X X  X X      X  X */
  1280. X/* X  X  X   XXX  X  X */
  1281. X/* X  X   X  X      XXX  */
  1282. X/* X  X X  X X      X X  */
  1283. X/*  XX     XX  XXXX X  X */
  1284. X
  1285. XUWORD chip prog_image_data[] = {
  1286. X   0,    0,   0,   0,
  1287. X   0,    0,   0,   0,
  1288. X   0,    0,   0,   0,
  1289. X   4095,   65247,   65535,   32768,
  1290. X   4095,   63683,   65535,   32768,
  1291. X   4095,   57728,   65535,   32768,
  1292. X   4095,   49536,   16383,   32768,
  1293. X   4095,   33536,   8191,   32768,
  1294. X   4095,   33536,   8191,   32768,
  1295. X   4095,   1536,   4095,   32768,
  1296. X   4095,   1920,   4095,   32768,
  1297. X   4094,   3279,   51199,   32768,
  1298. X   4094,   3276,   26623,   32768,
  1299. X   4094,   6552,   14335,   32768,
  1300. X   4094,   6552,   14335,   32768,
  1301. X   4094,   13080,   26623,   32768,
  1302. X   4094,   13104,   51199,   32768,
  1303. X   4095,   63,     36863,   32768,
  1304. X   4095,   48,     4095,     32768,
  1305. X   4095,   32864,   8191,   32768,
  1306. X   4095,   32864,   16383,   32768,
  1307. X   4095,   49248,   32767,   32768,
  1308. X   4095,   61633,   65535,   32768,
  1309. X   4095,   64711,   65535,   32768,
  1310. X   4095,   65247,   65535,   32768,
  1311. X   0,    0,   0,   0,
  1312. X   4095,   65535,   65535,   32768,
  1313. X   4095,   65535,   65535,   32768,
  1314. X   4095,   65535,   65535,   32768,
  1315. X   4095,   65535,   65535,   32768,
  1316. X   4095,   65535,   65535,   32768,
  1317. X   4095,   65535,   65535,   32768,
  1318. X   4095,   65535,   65535,   32768,
  1319. X   4095,   65535,   65535,   32768,
  1320. X   4095,   65535,   65535,   32768,
  1321. X   4095,   65535,   65535,   32768,
  1322. X   4095,   65535,   65535,   32768,
  1323. X   4095,   65535,   65535,   32768,
  1324. X   4095,   65535,   65535,   32768,
  1325. X   0,    0,   0,   0,
  1326. X   0,    0,   0,   0,
  1327. X   0,    0,   0,   0,
  1328. X
  1329. X   65535,   65535,   65535,   63488,
  1330. X   65535,   65535,   65535,   63488,
  1331. X   65535,   65535,   65535,   63488,
  1332. X   61440,   480,   0,    30720,
  1333. X   61440,   2044,   0,     30720,
  1334. X   61440,   8191,   0,     30720,
  1335. X   61440,   16383,   49152,   30720,
  1336. X   61440,   32767,   57344,   30720,
  1337. X   61440,   32767,   57344,   30720,
  1338. X   61440,   65535,   61440,   30720,
  1339. X   61440,   65535,   61440,   30720,
  1340. X   61441,   65535,   63488,   30720,
  1341. X   61441,   65535,   63488,   30720,
  1342. X   61441,   65535,   63488,   30720,
  1343. X   61441,   65535,   63488,   30720,
  1344. X   61441,   65535,   63488,   30720,
  1345. X   61441,   65535,   63488,   30720,
  1346. X   61440,   65535,   61440,   30720,
  1347. X   61440,   65535,   61440,   30720,
  1348. X   61440,   32767,   57344,   30720,
  1349. X   61440,   32767,   49152,   30720,
  1350. X   61440,   16383,   32768,   30720,
  1351. X   61440,   4094,   0,     30720,
  1352. X   61440,   1016,   0,     30720,
  1353. X   61440,   480,   0,    30720,
  1354. X   65535,   65535,   65535,   63488,
  1355. X   61440,   0,     0,   30720,
  1356. X   61440,   0,     0,   30720,
  1357. X   61440,   0,     0,   30720,
  1358. X   61694,   16259,   49400,   30720,
  1359. X   61539,   6342,   24972,   30720,
  1360. X   61539,   6348,   13056,   30720,
  1361. X   61566,   8076,   13084,   30720,
  1362. X   61536,   6540,   13068,   30720,
  1363. X   61536,   6342,   24972,   30720,
  1364. X   61688,   14435,   49404,   30720,
  1365. X   61440,   0,     0,   30720,
  1366. X   61440,   0,     0,   30720,
  1367. X   61440,   0,     0,   30720,
  1368. X   65535,   65535,   65535,   63488,
  1369. X   65535,   65535,   65535,   63488,
  1370. X   65535,   65535,   65535,   63488,
  1371. X};
  1372. X
  1373. XUWORD chip off_image_data[] = {
  1374. X   0,
  1375. X   0,
  1376. X   0,
  1377. X   0,
  1378. X   0,
  1379. X   0,
  1380. X   0,
  1381. X   0,
  1382. X   0,
  1383. X   0,
  1384. X   0,
  1385. X   0,
  1386. X   4095,
  1387. X   65247,
  1388. X   65535,
  1389. X   32768,
  1390. X   4095,
  1391. X   63683,
  1392. X   65535,
  1393. X   32768,
  1394. X   4095,
  1395. X   57728,
  1396. X   65535,
  1397. X   32768,
  1398. X   4095,
  1399. X   49536,
  1400. X   16383,
  1401. X   32768,
  1402. X   4095,
  1403. X   33536,
  1404. X   8191,
  1405. X   32768,
  1406. X   4095,
  1407. X   33536,
  1408. X   8191,
  1409. X   32768,
  1410. X   4095,
  1411. X   1536,
  1412. X   4095,
  1413. X   32768,
  1414. X   4095,
  1415. X   1920,
  1416. X   4095,
  1417. X   32768,
  1418. X   4094,
  1419. X   3279,
  1420. X   51199,
  1421. X   32768,
  1422. X   4094,
  1423. X   3276,
  1424. X   26623,
  1425. X   32768,
  1426. X   4094,
  1427. X   6552,
  1428. X   14335,
  1429. X   32768,
  1430. X   4094,
  1431. X   6552,
  1432. X   14335,
  1433. X   32768,
  1434. X   4094,
  1435. X   13080,
  1436. X   26623,
  1437. X   32768,
  1438. X   4094,
  1439. X   13104,
  1440. X   51199,
  1441. X   32768,
  1442. X   4095,
  1443. X   63,
  1444. X   36863,
  1445. X   32768,
  1446. X   4095,
  1447. X   48,
  1448. X   4095,
  1449. X   32768,
  1450. X   4095,
  1451. X   32864,
  1452. X   8191,
  1453. X   32768,
  1454. X   4095,
  1455. X   32864,
  1456. X   16383,
  1457. X   32768,
  1458. X   4095,
  1459. X   49248,
  1460. X   32767,
  1461. X   32768,
  1462. X   4095,
  1463. X   61633,
  1464. X   65535,
  1465. X   32768,
  1466. X   4095,
  1467. X   64711,
  1468. X   65535,
  1469. X   32768,
  1470. X   4095,
  1471. X   65247,
  1472. X   65535,
  1473. X   32768,
  1474. X   0,
  1475. X   0,
  1476. X   0,
  1477. X   0,
  1478. X   4095,
  1479. X   65535,
  1480. X   65535,
  1481. X   32768,
  1482. X   4032,
  1483. X   32259,
  1484. X   57351,
  1485. X   32768,
  1486. X   3840,
  1487. X   30723,
  1488. X   49155,
  1489. X   32768,
  1490. X   3128,
  1491. X   25027,
  1492. X   49635,
  1493. X   32768,
  1494. X   4088,
  1495. X   32707,
  1496. X   50175,
  1497. X   32768,
  1498. X   4088,
  1499. X   32707,
  1500. X   50175,
  1501. X   32768,
  1502. X   4088,
  1503. X   32707,
  1504. X   50175,
  1505. X   32768,
  1506. X   4088,
  1507. X   32707,
  1508. X   50175,
  1509. X   32768,
  1510. X   4088,
  1511. X   32707,
  1512. X   50175,
  1513. X   32768,
  1514. X   4088,
  1515. X   32707,
  1516. X   49635,
  1517. X   32768,
  1518. X   4088,
  1519. X   32707,
  1520. X   49155,
  1521. X   32768,
  1522. X   4088,
  1523. X   32707,
  1524. X   57351,
  1525. X   32768,
  1526. X   4095,
  1527. X   65535,
  1528. X   65535,
  1529. X   32768,
  1530. X   0,
  1531. X   0,
  1532. X   0,
  1533. X   0,
  1534. X   0,
  1535. X   0,
  1536. X   0,
  1537. X   0,
  1538. X   0,
  1539. X   0,
  1540. X   0,
  1541. X   0,
  1542. X   65535,
  1543. X   65535,
  1544. X   65535,
  1545. X   63488,
  1546. X   65535,
  1547. X   65535,
  1548. X   65535,
  1549. X   63488,
  1550. X   65535,
  1551. X   65535,
  1552. X   65535,
  1553. X   63488,
  1554. X   61440,
  1555. X   288,
  1556. X   0,
  1557. X   30720,
  1558. X   61440,
  1559. X   1852,
  1560. X   0,
  1561. X   30720,
  1562. X   61440,
  1563. X   7807,
  1564. X   0,
  1565. X   30720,
  1566. X   61440,
  1567. X   15999,
  1568. X   49152,
  1569. X   30720,
  1570. X   61440,
  1571. X   31999,
  1572. X   57344,
  1573. X   30720,
  1574. X   61440,
  1575. X   31999,
  1576. X   57344,
  1577. X   30720,
  1578. X   61440,
  1579. X   63999,
  1580. X   61440,
  1581. X   30720,
  1582. X   61440,
  1583. X   63615,
  1584. X   61440,
  1585. X   30720,
  1586. X   61441,
  1587. X   62256,
  1588. X   14336,
  1589. X   30720,
  1590. X   61441,
  1591. X   62259,
  1592. X   38912,
  1593. X   30720,
  1594. X   61441,
  1595. X   58983,
  1596. X   51200,
  1597. X   30720,
  1598. X   61441,
  1599. X   58983,
  1600. X   51200,
  1601. X   30720,
  1602. X   61441,
  1603. X   52455,
  1604. X   38912,
  1605. X   30720,
  1606. X   61441,
  1607. X   52431,
  1608. X   14336,
  1609. X   30720,
  1610. X   61440,
  1611. X   65472,
  1612. X   28672,
  1613. X   30720,
  1614. X   61440,
  1615. X   65487,
  1616. X   61440,
  1617. X   30720,
  1618. X   61440,
  1619. X   32671,
  1620. X   57344,
  1621. X   30720,
  1622. X   61440,
  1623. X   32671,
  1624. X   49152,
  1625. X   30720,
  1626. X   61440,
  1627. X   16287,
  1628. X   32768,
  1629. X   30720,
  1630. X   61440,
  1631. X   3902,
  1632. X   0,
  1633. X   30720,
  1634. X   61440,
  1635. X   824,
  1636. X   0,
  1637. X   30720,
  1638. X   61440,
  1639. X   288,
  1640. X   0,
  1641. X   30720,
  1642. X   65535,
  1643. X   65535,
  1644. X   65535,
  1645. X   63488,
  1646. X   61440,
  1647. X   0,
  1648. X   0,
  1649. X   30720,
  1650. X   61503,
  1651. X   33276,
  1652. X   8184,
  1653. X   30720,
  1654. X   61695,
  1655. X   34812,
  1656. X   16380,
  1657. X   30720,
  1658. X   62407,
  1659. X   40508,
  1660. X   15900,
  1661. X   30720,
  1662. X   61447,
  1663. X   32828,
  1664. X   15360,
  1665. X   30720,
  1666. X   61447,
  1667. X   32828,
  1668. X   15360,
  1669. X   30720,
  1670. X   61447,
  1671. X   32828,
  1672. X   15360,
  1673. X   30720,
  1674. X   61447,
  1675. X   32828,
  1676. X   15360,
  1677. X   30720,
  1678. X   61447,
  1679. X   32828,
  1680. X   15360,
  1681. X   30720,
  1682. X   61447,
  1683. X   32828,
  1684. X   15900,
  1685. X   30720,
  1686. X   61447,
  1687. X   32828,
  1688. X   16380,
  1689. X   30720,
  1690. X   61447,
  1691. X   32828,
  1692. X   8184,
  1693. X   30720,
  1694. X   61440,
  1695. X   0,
  1696. X   0,
  1697. X   30720,
  1698. X   65535,
  1699. X   65535,
  1700. X   65535,
  1701. X   63488,
  1702. X   65535,
  1703. X   65535,
  1704. X   65535,
  1705. X   63488,
  1706. X   65535,
  1707. X   65535,
  1708. X   65535,
  1709. X   63488,
  1710. X};
  1711. X
  1712. X
  1713. SHAR_EOF
  1714. echo "End of archive 1 (of 3)"
  1715. # if you want to concatenate archives, remove anything after this line
  1716. exit
  1717.